package edu.npu.cv.dto;

import edu.npu.cv.entity.MemberDO;
import edu.npu.cv.utils.MarkDownUtil;
import lombok.Data;

/**
 * @ClassName MemberDTO
 * @Description TODO
 * @Author Quentin_zyj
 * @Date 2021/11/19 15:01
 */
@Data
public class MemberDTO {
    private long id;
    private String name;
    private String degree;
    private String subject;
    private String imgUrl;
    private String introduction;
    private String introductionDetail;

    public static MemberDTO memberDO2DTO(MemberDO memberDO) {
        MemberDTO memberDTO = new MemberDTO();
        memberDTO.setId(memberDO.getId() >= 0 ? memberDO.getId() : 0L);
        memberDTO.setDegree(memberDO.getDegree());
        memberDTO.setImgUrl(memberDO.getImgUrl());
        memberDTO.setIntroduction(memberDO.getIntroduction());
        memberDTO.setSubject(memberDO.getSubject());
        memberDTO.setIntroductionDetail(MarkDownUtil.mdToHtml(memberDO.getIntroductionDetail()));
        memberDTO.setName(memberDO.getName());
        return memberDTO;
    }

}
